<style>
.ui-combobox {
      position: relative;
      display: inline-block;
      margin-bottom: 10px;
      width:90%;
}
.ui-button-icon-only {
      position: absolute;
      top: 0;
      bottom: 0;
      margin-left: -1px;
      padding: 0;
      /* adjust styles for IE 6/7 */
      *height: 1.7em;
      *top: 0.1em;
}
.ui-autocomplete-input {
      margin: 0;
      padding: 0.3em;
      width:90%;
}
</style>
      <div class="adminrectangle"><h2><?php echo $title;?></h2></div>
      <div class="grid_12 alpha omega">
      <h5><?php echo sprintf(lang('edit_result_for_stage'), $stage->stage_id); ?></h5>
      </div>
	<div class='clear'></div>
   <?php if(isset($message))
   {
   ?>
   <div id="infoMessage" style="display:none;"><?php echo $message;?></div>
   <?php
  }
  ?>
      <?php
      if(isset($help_message_text))
      {
        if($help_message_text !="")
        {
      ?>
          <div id="helpMessage" title="<?php echo lang($help_message_title);?>" style="display:none;"><?php echo lang($help_message_text);?></div>
      <?php
        }
      }
      ?>
  <?php echo form_open("admin/edit_result/".$stage->stage_id, "name='formname'");?>    
	<!-- Stage Results -->
  <div class="grid_4 alpha">
    <h5><?php echo lang('stage_results');?></h5>
    <?php if(isset($stage_result)) { ?>
    <?php foreach ($stage_result as $key => $value)
    { ?>
    <div class="label"><?php echo lang('stage_position') . " " . ($key+1); ?></div>
    <div class='clear'></div>
    <div><?php echo form_dropdown('stage_result['.$key.']', $rider_options, $stage_result[$key],'class="ui-widget combobox"'); ?></div>
    <?php
    }
    }
    ?>
  </div>

  <div class="grid_4">

    <h5><?php echo sprintf(lang('standings_after_stage'), $stage->stage_id);?></h5>
    <?php if(isset($stage_yellow)) { ?>
    <!-- Yellow jersey after stage -->
    <div class=" overallStanding">
      <h6><?php echo lang('overall_standing');?></h6>
      <?php foreach ($stage_yellow as $key => $value)
      { ?>
      <div class="label"><?php echo lang('overall_standing') . " " . ($key+1); ?></div>
      <div class='clear'></div>
      <div><?php echo form_dropdown('stage_yellow['.$key.']', $rider_options, $stage_yellow[$key],'class="ui-widget combobox"'); ?></div>
      <?php
      }
      ?>
    </div>
    <?php } ?>


    <?php if(isset($stage_green)) { ?>
    <!-- Green jersey after stage -->
    <div class="pointsStanding">
      <h6><?php echo lang('points_standing');?></h6>
      <?php foreach ($stage_green as $key => $value)
      { ?>
      <div class="label"><?php echo lang('points_standing') . " " .($key+1); ?></div>
      <div class='clear'></div>
      <div><?php echo form_dropdown('stage_green['.$key.']', $rider_options, $stage_green[$key],'class="ui-widget combobox"'); ?></div>
      <?php
      }
      ?>
    </div>
    <?php } ?>

    <?php if(isset($stage_mountain)) { ?>
    <!-- Mountain jersey after stage -->
    <div class="mountainStanding">
      <h6><?php echo lang('mountain_standing');?></h6>
      <?php foreach ($stage_mountain as $key => $value)
      { ?>
      <div class="label"><?php echo lang('mountain_standing') . " " .($key+1); ?></div>
      <div class='clear'></div>
      <div><?php echo form_dropdown('stage_mountain['.$key.']', $rider_options, $stage_mountain[$key],'class="ui-widget combobox"'); ?></div>
      <?php
      }
      ?>
    </div>
    <?php } ?>

  </div> 
  <div class="grid_4 omega">
    <?php if(isset($top_10)) { ?>
    <h5><?php echo lang('top_10_for_stage');?></h5>
    <table style="width:100%;">
      <tr><th><?php echo lang('position');?></th><th><?php echo lang('user_team');?></th><th><?php echo lang('points');?></th></tr>
    <?php
    $p = 1;
    foreach($top_10 as $user)
    {
    ?>
      <tr>
        <td class='centertext'><?php echo $p;?></td>
        <td><?php echo $user->username;?></td>
        <td class='centertext'><?php echo $user->points_total." ".lang('points');?></td>
      </tr>
    <?php
    $p++;
    }
    ?>
    </table>
    <?php } ?>
  </div>
  <div class='clear'></div>          
  <div class="buttons">
  	<button type="submit" class="button"><span class="icon icon39"></span><span class='label'><?php echo lang('save')."&nbsp;&amp;&nbsp;".lang('calculate');?></span></button>
  	
     <?php echo anchor("admin/stages","<span class='icon icon7'></span><span class='label'>".lang('cancel')."</span>","class='button'");?>
        <?php echo form_close();?>
  </div>
  <div class="clear"></div>

      <script src="<?php echo base_url();?>assets/admin/js/jquery.ui.combobox.js"></script>
      <script>
      $(function() {
            $( ".combobox" ).combobox();
            });
      </script>
